package com.rs.controller;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.border.EmptyBorder;

import com.rs.model.ZhEmployment;
import com.rs.service.ZhEmploymentService;
import com.rs.util.SpringContextUtils;

public class EmploymentDetailed extends JFrame {

	private JPanel contentPane;
	
	
	private JTextField text_userName;
	private JTextField text_enterprise;
	private JTextField text_address;
	private JTextField text_salary;
	private JTextField text_phone;
	private JTextField text_class;
	
	private ZhEmploymentService emp = SpringContextUtils.getBean(ZhEmploymentService.class);
	
	private  int  id;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					EmploymentDetailed frame = new EmploymentDetailed();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	
	public EmploymentDetailed() {
		
	}
	public EmploymentDetailed(int  id) {
		setBounds(100, 100, 528, 413);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JLabel label_userName = new JLabel("姓名：");
		label_userName.setHorizontalAlignment(SwingConstants.RIGHT);
		label_userName.setBounds(55, 91, 74, 26);
		contentPane.add(label_userName);
		
		JLabel label_class = new JLabel("班级：");
		label_class.setHorizontalAlignment(SwingConstants.RIGHT);
		label_class.setBounds(55, 144, 74, 26);
		contentPane.add(label_class);
		
		JLabel label_enterprise = new JLabel("企业名称：");
		label_enterprise.setHorizontalAlignment(SwingConstants.RIGHT);
		label_enterprise.setBounds(263, 197, 74, 26);
		contentPane.add(label_enterprise);
		
		JLabel label_address = new JLabel("就业地址：");
		label_address.setHorizontalAlignment(SwingConstants.RIGHT);
		label_address.setBounds(263, 91, 74, 26);
		contentPane.add(label_address);
		
		JLabel label_salary = new JLabel("就业薪资：");
		label_salary.setHorizontalAlignment(SwingConstants.RIGHT);
		label_salary.setBounds(263, 144, 74, 26);
		contentPane.add(label_salary);
		
		text_userName = new JTextField();
		text_userName.setBounds(130, 94, 123, 26);
		contentPane.add(text_userName);
		text_userName.setColumns(10);
		
		text_enterprise = new JTextField();
		text_enterprise.setColumns(10);
		text_enterprise.setBounds(341, 198, 123, 26);
		contentPane.add(text_enterprise);
		
		text_address = new JTextField();
		text_address.setColumns(10);
		text_address.setBounds(341, 94, 123, 26);
		contentPane.add(text_address);
		
		text_salary = new JTextField();
		text_salary.setColumns(10);
		text_salary.setBounds(341, 147, 123, 26);
		contentPane.add(text_salary);
		
		
		
		JLabel label_phone = new JLabel("手机号：");
		label_phone.setHorizontalAlignment(SwingConstants.RIGHT);
		label_phone.setBounds(55, 203, 74, 26);
		contentPane.add(label_phone);
		
		text_phone = new JTextField();
		text_phone.setColumns(10);
		text_phone.setBounds(130, 200, 123, 26);
		contentPane.add(text_phone);
		
		text_class = new JTextField();
		text_class.setColumns(10);
		text_class.setBounds(130, 147, 123, 26);
		contentPane.add(text_class);
		
		
		ZhEmployment com = emp.zhEmploymentId(id);
		if(com.getZhUser() != null){
			text_userName.setText(com.getZhUser().getuName());
			text_phone.setText(com.getZhUser().getuPhone());
		}
		if(com.getZhClasses() !=null){
			text_class.setText(com.getZhClasses().getClName());
		}
		text_address.setText(com.getEmAddress());
		text_salary.setText(com.getEmSalary()+"");
		text_enterprise.setText(com.getEmEnterprise());
		
		text_userName.setEditable(false);
		text_phone.setEditable(false);
		text_class.setEditable(false);
		text_address.setEditable(false);
		text_salary.setEditable(false);
		text_enterprise.setEditable(false);
		
	}
}
